package com.xsd.vistor.shopDemo;

/**
 * @Description: 访问者实现类
 * @Author: zhoufuzong
 * @Created: 2021-03-10 21:44:07
 * @Version: 1.1.0
 */

public class ShoppingCartImpl extends ShoppingCartVistor {
    @Override
    public double visitBook(Book book) {
        double total = book.getNumber() * book.getPrice();
        return total;
    }

    @Override
    public double visitFruit(Fruit fruit) {
        double total = fruit.getAmt()*fruit.getPrice();
        return total;
    }
}
